
;[UPDATE function name]

; #CURRENT# ----------------------------------------------
; Global Variable
; get_UninstallPath($G_FalconBuild)
;---------------------------------------------------------


; #Function# ---------------------------------------------
; Name...........: get_UninstallPath
; Description ...: Get the path of "DiskSafe Uninstall"
; Parameters ....: $G_FalconBuild
; Return values .: NA
;----------------------------------------------------------


;getabsPath($key)------------------------------------ [UPDATE]!!!! transfer_Para_in_File in Func.au3

#include <interface.au3>
#include <String.au3>
#include <Func_Install.au3>
#include <Func_Uninstall.au3>
#include <Func_Upgrade.au3>



Global $G_DS_version		= get_disksafe_version()
Global $G_DS_build			= get_disksafe_build()
Global $G_IMA_version		= get_ima_version()
Global $G_IMA_build			= get_ima_build()
Global $G_FalconBuild		= get_falcon_build()
Global $G_Action		    = get_action()
Global $G_BuildName			= "falcon"							;or "generic"

Global $G_DSexeName  		= "DiskSafe-" & $G_DS_version &"-" & $G_DS_build &"-IMA-" & $G_IMA_version & "-" & $G_IMA_build & _
								"-" & $G_BuildName &".exe"

Global $G_DSexePath     	= "C:\"
Global $G_UninstallPath 	= get_UninstallPath($G_FalconBuild)
Global $G_tmpFile 			= "C:\tmpFile.ini"
Global $G_title_Install		= "DiskSafe Installation"
Global $G_text_Install		= "&Yes"							;i.e. "You must restart your system"
Global $G_title_Uninstall	= "DiskSafe Uninstall"
Global $G_text_Uninstall	= "Are you sure you want to remove"
Global $G_titleUninReboot	= "DiskSafe Uninstall"
Global $G_textUninReboot	= "The system needs to reboot"
Global $G_title_Upgrade		= "DiskSafe Installation"
Global $G_text_Upgrade		= "&Yes"							;i.e. "You must restart your system"

Local $tmp_FileNotFound 	= "tmpFile not found"
Local $tmp_RecordSection	= "Record"
Local $tmp_RecordKey		= "mark"

Local $TypeAry[4]=["Service","Folder","File","Registry"]
Local $MARK_DontCare = "---"
Local $MARK_Equal    = "#"
Local $MARK_Diff     = "*"


Local $S_file 				= @ScriptDir & "\result\source.ini"
Local $D_file 				= @ScriptDir & "\result\destination.ini"
Local $SDcompare_file 		= @ScriptDir & "\result\SD_compare_result.ini"

Local $E_file_Section		= $ConfigPara
Local $E_file_Key			= "Expected_File_Name"

Local $E_fileName 			= IniRead($globalvariable_file_name,$E_file_Section,$E_file_Key,"Not found E_file path")
Local $E_file_location		= @ScriptDir & "\config\ExpectedFile"

Local $E_file				= $E_file_location & "\" & generate_expected_filename($E_fileName)

Local $E_fileNew			= $E_file_location & "\ExpectedFile-TMP.ini"

Local $R_file				= @ScriptDir & "\result\result.ini"
Local $Report_file 			= @ScriptDir & "\result\report.ini"
Local $Rule_file 			= @ScriptDir & "\config\rule.ini"
Local $Rule_Section     	= "Rule"

Local $Rule_Section			= "Rule Parameter"

;Local $R_SD_file = "result\source.ini"


Func get_UninstallPath($G_FalconBuild)
	Switch $G_FalconBuild
		Case 0	;not Falcon build
			return @ProgramsCommonDir & "\DiskSafe"
		Case 1	;is Falcon build
			return @ProgramsCommonDir & "\FalconStor"
	EndSwitch
EndFunc



;Get expected "File name"
Func generate_expected_filename($E_fileName)
	
	$value = IniRead($globalvariable_file_name,$E_file_Section,$E_file_Key,"Expected_File_Name Not Found")
	
	If $E_fileName <> $Default_Para_Setting Then
		
		Return $value		
	Else
				
		$DS_version = get_disksafe_version()	
		
		Switch 	$G_Action
			Case 1
				$st_Action = "Install"
				
			Case 2
				$st_Action = "Uninstall"
			
			Case 3
				$st_Action = "Upgrade"
		
		EndSwitch
		
		;ExpectedFile-Install-3.0
		
		$value = "ExpectedFile-" & $st_Action & "-" & $DS_version &".ini"
		Return $value	
	
	EndIf	
	
EndFunc





